import React, { useEffect } from "react";
import { AppProvider, KingsWallet, KingsWalletInstance } from "react-kings-wallet";
import "../styles/index.less";
import { wallet } from "../_api_";
import { check } from "../compoents/pay-password";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var Test = function() {
    var useRootState = KingsWalletInstance.useRootState;
    var state = useRootState();
    useEffect(function() {
        console.log("stateChange", state);
    }, [
        state
    ]);
    useEffect(function() {
        wallet.account.findAccount.request().then(function(res) {
            console.log("axios:", res);
        });
        KingsWalletInstance.getAccountAmount().then(function(res) {
            console.log("axios", res);
        });
        KingsWalletInstance.getUserAddress("ETH").then(function(res) {
            console.log("axios", res);
        });
        KingsWalletInstance.Api.wallet.baseWallet.walletAmount.request().then(function(res) {
            console.log("用户余额", res);
        });
        KingsWalletInstance.Api.wallet.baseWallet.coinAmount.request({
            accountId: 2797,
            coinId: 6
        }).then(function(res) {
            console.log("axios coinAmount", res);
        });
        KingsWalletInstance.Api.wallet.baseWallet.addressBookList.request({
            addressAlias: "",
            currencyType: "BSC",
            userId: 2918
        }).then(function(res) {
            console.log("axios addressBookList", res);
        });
        KingsWalletInstance.Api.wallet.account.accountCoin.request().then(function(res) {
            console.log("axios accountCoin", res);
        });
    }, []);
    return /*#__PURE__*/ _jsx("div", {});
};
export default function() {
    React.useEffect(function() {
        KingsWalletInstance.on("connect", function(arg) {
            console.log(arg);
        });
        KingsWalletInstance.on("close", function() {
            console.log("login");
        });
        KingsWalletInstance.on("networkChanged", function(chainId) {
            console.log("networkChanged", chainId);
        });
        KingsWalletInstance.on("currencyChanged", function(currency) {
            console.log("currency", currency);
        });
    }, []);
    return /*#__PURE__*/ _jsxs(AppProvider, {
        children: [
            /*#__PURE__*/ _jsx(KingsWallet, {
                placement: "bottom-start",
                children: /*#__PURE__*/ _jsxs("div", {
                    style: {
                        width: 75,
                        height: 75,
                        border: "1PX solid red",
                        lineHeight: "75px",
                        textAlign: "center"
                    },
                    children: [
                        "test",
                        /*#__PURE__*/ _jsx(Test, {})
                    ]
                })
            }),
            /*#__PURE__*/ _jsx("button", {
                onClick: function() {
                    check({
                        type: "INPUT",
                        onOk: function(password) {
                            console.log(password);
                        }
                    });
                },
                children: "你点我试试"
            })
        ]
    });
};

 //# sourceMappingURL=exmple.js.map